package com.an.blog.web.domain;

import com.an.common.constant.UserConstants;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

/**
 * 博客登录表单
 *
 * @author: Ann
 * @createDate: 2023/06/01 21:55:10
 * @version: 1.0.0
 */
@Data
public class BlogLoginForm {

    /**
     * 用户名（邮箱号）
     */
    @NotBlank(message = "邮箱不能为空", groups = {PasswordLogin.class, CodeLogin.class})
    @Email(message = "邮箱格式不正确", groups = {PasswordLogin.class, CodeLogin.class})
    @Size(max = 50, message = "邮箱长度不能超过{max}个字符", groups = {PasswordLogin.class, CodeLogin.class})
    private String email;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空", groups = {PasswordLogin.class})
    @Length(min = UserConstants.PASSWORD_MIN_LENGTH,
        max = UserConstants.PASSWORD_MAX_LENGTH,
        message = "{blog.web.user.password.length.valid}", groups = {PasswordLogin.class})
    private String password;

    /**
     * 验证码
     */
    @NotBlank(message = "验证码不能为空")
    private String code;


    /**
     * 源
     */
    private String source;


    /**
     * 社会礼仪
     */
    private String socialCode;
    /**
     * 状态
     */
    private String state;

    public interface PasswordLogin {}

    public interface CodeLogin {}

}
